home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 June / macformat-038.iso / Demos / Notting Hill / ATHLETICS / HOME / 00002.ls < prev    next >
Encoding:
Text File  |  1996-02-08  |  5.2 KB  |  184 lines

  1. on exitFrame
  2.   global LastChannel, LastChannel, NumChannel, GfxChannel, SeqChannel, DVidChannel, CurtainChannel, first, AllScreen, CurrScreenID, ShowProgress1, rollList, clickList, ActList, ScreenCast, ScreenLinks, AddScreeb, ShowProgress1, NewScreenID, offList, OverChannel, BaseChannel, athsndflag, stasndflag, NumActive, EndChannel, NumChannels
  3.   if NewScreenID then
  4.     if first then
  5.       set first to 0
  6.       repeat with J = BaseChannel to LastChannel
  7.         puppetSprite(J, 1)
  8.       end repeat
  9.       puppetSprite(OverChannel, 1)
  10.       puppetSprite(GfxChannel, 1)
  11.       puppetSprite(SeqChannel, 1)
  12.       puppetSprite(DVidChannel, 1)
  13.       puppetSprite(CurtainChannel, 1)
  14.     end if
  15.     set ScreenInfo to getAt(AllScreen, NewScreenID)
  16.     set CurrScreenID to NewScreenID
  17.     set NewScreenID to 0
  18.     set ChangePalette to 0
  19.     if ScreenCast <> -1 then
  20.       set PalA to the palette of cast ScreenCast
  21.     else
  22.       set ChangePalette to 1
  23.     end if
  24.     set ScreenCast to getAt(ScreenInfo, 1)
  25.     if ScreenCast <> -1 then
  26.       set PalB to the palette of cast ScreenCast
  27.     end if
  28.     if PalA <> PalB then
  29.       set ChangePalette to 1
  30.     end if
  31.     if ChangePalette then
  32.       puppetPalette("Black", 27)
  33.     end if
  34.     puppetSprite(BaseChannel, 1)
  35.     set the castNum of sprite BaseChannel to ScreenCast
  36.     puppetSprite(CurtainChannel, 1)
  37.     set the castNum of sprite CurtainChannel to ScreenCast
  38.     updateStage()
  39.     if ChangePalette then
  40.       puppetPalette(PalB, 27)
  41.     end if
  42.     set ScreenLinks to [getAt(ScreenInfo, 2)]
  43.     append(ScreenLinks, getAt(ScreenInfo, 3))
  44.     append(ScreenLinks, getAt(ScreenInfo, 4))
  45.     NavSprites(ScreenLinks)
  46.     set offList to []
  47.     set rollList to []
  48.     set clickList to []
  49.     set ActList to []
  50.     set CurrChannel to BaseChannel + 1
  51.     set NumActive to 0
  52.     repeat with Element in ScreenInfo
  53.       if listp(Element) then
  54.         set NumActive to NumActive + 1
  55.         append(offList, getAt(Element, 1))
  56.         set ActID to count(Element)
  57.         if ActID = 2 then
  58.           set RollID to 1
  59.           set ClickID to 1
  60.         else
  61.           if ActID = 3 then
  62.             set RollID to 2
  63.             set ClickID to 2
  64.           else
  65.             if ActID = 4 then
  66.               set RollID to 2
  67.               set ClickID to 3
  68.             end if
  69.           end if
  70.         end if
  71.         append(rollList, getAt(Element, RollID))
  72.         append(clickList, getAt(Element, ClickID))
  73.         append(ActList, getAt(Element, ActID))
  74.         puppetSprite(CurrChannel, 1)
  75.         set the castNum of sprite CurrChannel to getAt(Element, 1)
  76.         set CurrChannel to CurrChannel + 1
  77.       end if
  78.     end repeat
  79.     repeat with J = NumActive + 1 to NumChannels
  80.       puppetSprite(CurrChannel, 1)
  81.       set the castNum of sprite CurrChannel to 3
  82.       set CurrChannel to CurrChannel + 1
  83.     end repeat
  84.     ResetRoll()
  85.     resetGfx()
  86.     resetSeq()
  87.     resetVideo()
  88.     set the castNum of sprite CurtainChannel to 3
  89.   end if
  90.   set c to the mouseCast
  91.   if (c >= 5) and (c <= 7) then
  92.     if c = 7 then
  93.       cursor([22, 23])
  94.       if the mouseDown then
  95.         set NewScreenID to getAt(ScreenLinks, 3)
  96.       end if
  97.     else
  98.       if c = 5 then
  99.         cursor([20, 21])
  100.         if the mouseDown then
  101.           set NewScreenID to getAt(ScreenLinks, 1)
  102.         end if
  103.       else
  104.         cursor([24, 25])
  105.         if the mouseDown then
  106.           set NewScreenID to getAt(ScreenLinks, 2)
  107.         end if
  108.       end if
  109.     end if
  110.   else
  111.     set ActiveChannel to 0
  112.     set StdCursor to 1
  113.     set rollAt to getPos(rollList, c)
  114.     if rollAt then
  115.       set ActiveChannel to rollAt + BaseChannel
  116.       if soundBusy(1) then
  117.         put "busy"
  118.         go(the frame)
  119.         exit
  120.       end if
  121.       if the mouseDown then
  122.         cursor(200)
  123.         set the castNum of sprite OverChannel to getAt(clickList, rollAt)
  124.         updateStage()
  125.         repeat while the mouseDown
  126.         end repeat
  127.         cursor(0)
  128.         decode(getAt(ActList, rollAt))
  129.         if (the castNum of sprite 25 = 121) and (athsndflag = 0) then
  130.           set athsndflag to 1
  131.           set stasndflag to 0
  132.           puppetSound(2, 141)
  133.           updateStage()
  134.         end if
  135.         if (the castNum of sprite 25 = 123) and (stasndflag = 0) then
  136.           puppetSound(2, 142)
  137.           set stasndflag to 1
  138.           set athsndflag to 0
  139.           updateStage()
  140.         end if
  141.         repeat while rollOver(25)
  142.           nothing()
  143.         end repeat
  144.       end if
  145.     else
  146.       set offAt to getPos(offList, c)
  147.       if offAt then
  148.         set ActiveChannel to offAt + BaseChannel
  149.         puppetSprite(ActiveChannel, 1)
  150.         set the castNum of sprite OverChannel to getAt(rollList, offAt)
  151.       end if
  152.     end if
  153.     if ActiveChannel then
  154.       set StdCursor to 0
  155.       if not soundBusy(1) then
  156.         cursor([28, 29])
  157.       end if
  158.     else
  159.       set the castNum of sprite OverChannel to 3
  160.     end if
  161.     if StdCursor then
  162.       cursor(0)
  163.     end if
  164.   end if
  165.   if NewScreenID then
  166.     put "Going to " & NewScreenID
  167.     repeat while the mouseDown
  168.     end repeat
  169.   end if
  170.   go(the frame)
  171. end
  172.  
  173. on NavSprites ScreenLinks
  174.   repeat with J = 1 to 3
  175.     set ch to 44 + J
  176.     puppetSprite(ch, 1)
  177.     if getAt(ScreenLinks, J) then
  178.       set the visible of sprite ch to 1
  179.       next repeat
  180.     end if
  181.     set the visible of sprite ch to 0
  182.   end repeat
  183. end
  184.